<?php if (!defined('THINK_PATH')) exit(); /*a:6:{s:46:"F:\chat/application/push\view\index\index.html";i:1573178747;s:45:"F:\chat\application\push\view\index\left.html";i:1573009909;s:47:"F:\chat\application\push\view\index\center.html";i:1573199489;s:50:"F:\chat\application\push\view\common\calendar.html";i:1573008766;s:46:"F:\chat\application\push\view\index\right.html";i:1573205322;s:47:"F:\chat\application\push\view\common\emoji.html";i:1573205244;}*/ ?>
<html>

<head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <META HTTP-EQUIV="pragma" content="no-cache">
    <META HTTP-EQUIV="Cache-Control" content="no-store, must-revalidate">
    <META HTTP-EQUIV="expires" content="0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>首页</title>

    <link href="https://libs.cdnjs.net/twitter-bootstrap/4.3.1/css/bootstrap.css" rel="stylesheet">
    <link href="//at.alicdn.com/t/font_1494741_ocv8339blrb.css" rel="stylesheet">
    <link href="/public/chat/css/main.css" rel="stylesheet">


    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://libs.cdnjs.net/twitter-bootstrap/4.3.1/js/bootstrap.js"></script>
    <script src="https://libs.cdnjs.net/twitter-bootstrap/3.2.0/js/alert.js"></script>
    <script type="text/javascript" src="/public/vendor/layer/layer.js"></script>
    <script type="text/javascript" src="/public/chat/js/main.js"></script>



    <body onload="connect();">
        <div class="home">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-3 col-sm-5 col-12">
                        <div class="row">

                            <div class="left" id="nav">
    <ul>
        <li class="user active" onclick="cutoverNav(this,'all')"><a href="javascript:;">Z</a></li>
        <li class="message" onclick="cutoverNav(this,'list')">
            <div class="ide"></div>
            <a href="javascript:;"></a>
        </li>
        <li class="contacts" onclick="cutoverNav(this,'list2')">
            <div class="ide"></div>
            <a href="javascript:;"></a>
        </li>
    </ul>
    <div class="foot" onclick="cutoverAdd()">+</div>
    <div class="float hidden" id="addnav">
        <div class="triangle"></div>
        <a href="javascript:;" onclick="addfriend('group')">创建群聊</a>
        <a href="javascript:;" onclick="addfriend('friend')">添加好友</a>
    </div>
</div>
                            <!--  -->
                            <div class="center">
    <form class="searchArea ng-pristine ng-valid">
        <div class="form-group"><input type="text" class="form-control" placeholder="搜索">
            <i class="clearInputBtn"></i>
            <label class="" for="groupSearch4"></label>
        </div>
    </form>
    <div class="box">

        <div class="list0">

            <!--  -->
            <link rel="stylesheet" href="/public/vendor/calendar/css/common.css">
<link rel="stylesheet" href="/public/vendor/calendar/css/index.css">
<link rel="stylesheet" href="/public/vendor/calendar/css/swiper-3.3.1.min.css">

<!-- <script src="/public/vendor/calendar/js/jquery-1.11.0.js"></script> -->
<script type="text/javascript" src="/public/vendor/calendar/js/swiper-3.3.1.min.js"></script>


<!-- 加载ing -->
<div class="loading loading1 covers">
    <div class="loading-bj"></div>
    <p>加载中...</p>
</div>
<!-- 加载ing END -->
<section class="out-wrap">
    <div class="header-main">
        <section class="day">
            <section class="grid clearfix">
                <div class="day-left clearfix date">
                    <h1 id="top_shu"></h1>
                    <div class="top-contrl">
                        <p><em class="f34" id="ymym"></em>&emsp;<em id="top_week"></em></p>
                        <div><i id="top_yue"></i></div>
                        <!-- <p><em id="ymym" class="date">2016年06月</em><span></span></p>
                            <div><i id="top_yue">八月廿十</i><em id="top_week">星期二</em></div> -->
                    </div>
                </div>
                <div class="day-right clearfix">
                    <div class="yun">
                        <span class="js_jin">今</span>
                    </div>
                </div>
            </section>
        </section>
        <!-- end day -->
    </div>
    <!-- end header -->
    <section class="content">

        <section class="week">
            <ul class="clearfix f28">
                <li><a href="#">日</a></li>
                <li><a href="#">一</a></li>
                <li><a href="#">二</a></li>
                <li><a href="#">三</a></li>
                <li><a href="#">四</a></li>
                <li><a href="#">五</a></li>
                <li><a href="#">六</a></li>
            </ul>
        </section>
        <section class="calenda">
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <div class="swiper-slide">
                        <table id="now1" class="tables">
                            <tr class="">
                                <td class=" list"><i>12</i><em>中秋</em></td>
                            </tr>
                        </table>
                    </div>
                    <div class="swiper-slide">
                        <table id="now2" class="tables">
                            <tr class="">
                                <td class=" list"><i>12</i><em>中秋</em></td>
                                <td class=" list"><i>12</i><em>中秋</em></td>
                                <td class=" list"><i>12</i><em>中秋</em></td>
                                <td class=" list"><i>12</i><em>中秋</em></td>
                                <td class=" list"><i>12</i><em>中秋</em></td>
                                <td class=" list"><i>12</i><em>中秋</em></td>
                                <td class=" list"><i>12</i><em>中秋</em></td>
                            </tr>
                        </table>
                    </div>
                    <div class="swiper-slide">
                        <table id="now3" class="tables">
                            <tr class="">
                                <td class="list"><i>12</i><em>中秋</em></td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </section>

        <!-- end calenda -->
    </section>
    <!-- end content -->
    <section class="prorup"></section>
    <!-- 弹窗 -->
    <div class="tc"></div>
    <div class="tc-innner">
        <h2>
            <!--  <div class="title-right">
                     <div class="gl zblck active">公历</div>
                     <div class="nl zblck">农历</div>
                 </div> -->
            选择日期
        </h2>
        <div class="current-time">
            <i class="i-year">1900</i><i class="i-month">1</i><i class="i-date">1</i>
        </div>
        <div class="swiper-box">
            <i class="i1"></i>
            <i class="i2"></i>
            <i class="i3"></i>
            <div class="swiper-box-li">
                <div class="swiper-container2 nbxs">
                    <div class="swiper-wrapper year">
                        <div class="swiper-slide">1900年</div>
                        <div class="swiper-slide">1901年</div>
                        <div class="swiper-slide">1902年</div>
                        <div class="swiper-slide">1903年</div>
                        <div class="swiper-slide">1904年</div>
                        <div class="swiper-slide">1905年</div>
                        <div class="swiper-slide">1906年</div>
                        <div class="swiper-slide">1907年</div>
                        <div class="swiper-slide">1908年</div>
                        <div class="swiper-slide">1909年</div>
                        <div class="swiper-slide">1910年</div>
                        <div class="swiper-slide">1911年</div>
                        <div class="swiper-slide">1912年</div>
                        <div class="swiper-slide">1913年</div>
                        <div class="swiper-slide">1914年</div>
                        <div class="swiper-slide">1915年</div>
                        <div class="swiper-slide">1916年</div>
                        <div class="swiper-slide">1917年</div>
                        <div class="swiper-slide">1918年</div>
                        <div class="swiper-slide">1919年</div>
                        <div class="swiper-slide">1920年</div>
                        <div class="swiper-slide">1921年</div>
                        <div class="swiper-slide">1922年</div>
                        <div class="swiper-slide">1923年</div>
                        <div class="swiper-slide">1924年</div>
                        <div class="swiper-slide">1925年</div>
                        <div class="swiper-slide">1926年</div>
                        <div class="swiper-slide">1927年</div>
                        <div class="swiper-slide">1928年</div>
                        <div class="swiper-slide">1929年</div>
                        <div class="swiper-slide">1930年</div>
                        <div class="swiper-slide">1931年</div>
                        <div class="swiper-slide">1932年</div>
                        <div class="swiper-slide">1933年</div>
                        <div class="swiper-slide">1934年</div>
                        <div class="swiper-slide">1935年</div>
                        <div class="swiper-slide">1936年</div>
                        <div class="swiper-slide">1937年</div>
                        <div class="swiper-slide">1938年</div>
                        <div class="swiper-slide">1939年</div>
                        <div class="swiper-slide">1940年</div>
                        <div class="swiper-slide">1941年</div>
                        <div class="swiper-slide">1942年</div>
                        <div class="swiper-slide">1943年</div>
                        <div class="swiper-slide">1944年</div>
                        <div class="swiper-slide">1945年</div>
                        <div class="swiper-slide">1946年</div>
                        <div class="swiper-slide">1947年</div>
                        <div class="swiper-slide">1948年</div>
                        <div class="swiper-slide">1949年</div>
                        <div class="swiper-slide">1950年</div>
                        <div class="swiper-slide">1951年</div>
                        <div class="swiper-slide">1952年</div>
                        <div class="swiper-slide">1953年</div>
                        <div class="swiper-slide">1954年</div>
                        <div class="swiper-slide">1955年</div>
                        <div class="swiper-slide">1956年</div>
                        <div class="swiper-slide">1957年</div>
                        <div class="swiper-slide">1958年</div>
                        <div class="swiper-slide">1959年</div>
                        <div class="swiper-slide">1960年</div>
                        <div class="swiper-slide">1961年</div>
                        <div class="swiper-slide">1962年</div>
                        <div class="swiper-slide">1963年</div>
                        <div class="swiper-slide">1964年</div>
                        <div class="swiper-slide">1965年</div>
                        <div class="swiper-slide">1966年</div>
                        <div class="swiper-slide">1967年</div>
                        <div class="swiper-slide">1968年</div>
                        <div class="swiper-slide">1969年</div>
                        <div class="swiper-slide">1970年</div>
                        <div class="swiper-slide">1971年</div>
                        <div class="swiper-slide">1972年</div>
                        <div class="swiper-slide">1973年</div>
                        <div class="swiper-slide">1974年</div>
                        <div class="swiper-slide">1975年</div>
                        <div class="swiper-slide">1976年</div>
                        <div class="swiper-slide">1977年</div>
                        <div class="swiper-slide">1978年</div>
                        <div class="swiper-slide">1979年</div>
                        <div class="swiper-slide">1980年</div>
                        <div class="swiper-slide">1981年</div>
                        <div class="swiper-slide">1982年</div>
                        <div class="swiper-slide">1983年</div>
                        <div class="swiper-slide">1984年</div>
                        <div class="swiper-slide">1985年</div>
                        <div class="swiper-slide">1986年</div>
                        <div class="swiper-slide">1987年</div>
                        <div class="swiper-slide">1988年</div>
                        <div class="swiper-slide">1989年</div>
                        <div class="swiper-slide">1990年</div>
                        <div class="swiper-slide">1991年</div>
                        <div class="swiper-slide">1992年</div>
                        <div class="swiper-slide">1993年</div>
                        <div class="swiper-slide">1994年</div>
                        <div class="swiper-slide">1995年</div>
                        <div class="swiper-slide">1996年</div>
                        <div class="swiper-slide">1997年</div>
                        <div class="swiper-slide">1998年</div>
                        <div class="swiper-slide">1999年</div>
                        <div class="swiper-slide">2000年</div>
                        <div class="swiper-slide">2001年</div>
                        <div class="swiper-slide">2002年</div>
                        <div class="swiper-slide">2003年</div>
                        <div class="swiper-slide">2004年</div>
                        <div class="swiper-slide">2005年</div>
                        <div class="swiper-slide">2006年</div>
                        <div class="swiper-slide">2007年</div>
                        <div class="swiper-slide">2008年</div>
                        <div class="swiper-slide">2009年</div>
                        <div class="swiper-slide">2010年</div>
                        <div class="swiper-slide">2011年</div>
                        <div class="swiper-slide">2012年</div>
                        <div class="swiper-slide">2013年</div>
                        <div class="swiper-slide">2014年</div>
                        <div class="swiper-slide">2015年</div>
                        <div class="swiper-slide">2016年</div>
                        <div class="swiper-slide">2017年</div>
                        <div class="swiper-slide">2018年</div>
                        <div class="swiper-slide">2019年</div>
                        <div class="swiper-slide">2020年</div>
                        <div class="swiper-slide">2021年</div>
                        <div class="swiper-slide">2022年</div>
                        <div class="swiper-slide">2023年</div>
                        <div class="swiper-slide">2024年</div>
                        <div class="swiper-slide">2025年</div>
                        <div class="swiper-slide">2026年</div>
                        <div class="swiper-slide">2027年</div>
                        <div class="swiper-slide">2028年</div>
                        <div class="swiper-slide">2029年</div>
                        <div class="swiper-slide">2030年</div>
                        <div class="swiper-slide">2031年</div>
                        <div class="swiper-slide">2032年</div>
                        <div class="swiper-slide">2033年</div>
                        <div class="swiper-slide">2034年</div>
                        <div class="swiper-slide">2035年</div>
                        <div class="swiper-slide">2036年</div>
                        <div class="swiper-slide">2037年</div>
                        <div class="swiper-slide">2038年</div>
                        <div class="swiper-slide">2039年</div>
                        <div class="swiper-slide">2040年</div>
                        <div class="swiper-slide">2041年</div>
                        <div class="swiper-slide">2042年</div>
                        <div class="swiper-slide">2043年</div>
                        <div class="swiper-slide">2044年</div>
                        <div class="swiper-slide">2045年</div>
                        <div class="swiper-slide">2046年</div>
                        <div class="swiper-slide">2047年</div>
                        <div class="swiper-slide">2048年</div>
                        <div class="swiper-slide">2049年</div>
                    </div>
                </div>
            </div>
            <div class="swiper-box-li">
                <div class="swiper-container3 nbxs">
                    <div class="swiper-wrapper month">
                        <div class="swiper-slide">1月</div>
                        <div class="swiper-slide">2月</div>
                        <div class="swiper-slide">3月</div>
                        <div class="swiper-slide">4月</div>
                        <div class="swiper-slide">5月</div>
                        <div class="swiper-slide">6月</div>
                        <div class="swiper-slide">7月</div>
                        <div class="swiper-slide">8月</div>
                        <div class="swiper-slide">9月</div>
                        <div class="swiper-slide">10月</div>
                        <div class="swiper-slide">11月</div>
                        <div class="swiper-slide">12月</div>
                    </div>
                </div>
            </div>
            <div class="swiper-box-li">
                <div class="swiper-container4 nbxs">
                    <div class="swiper-wrapper date">
                        <div class="swiper-slide">1日</div>
                        <div class="swiper-slide">2日</div>
                        <div class="swiper-slide">3日</div>
                        <div class="swiper-slide">4日</div>
                        <div class="swiper-slide">5日</div>
                        <div class="swiper-slide">6日</div>
                        <div class="swiper-slide">7日</div>
                        <div class="swiper-slide">8日</div>
                        <div class="swiper-slide">9日</div>
                        <div class="swiper-slide">10日</div>
                        <div class="swiper-slide">11日</div>
                        <div class="swiper-slide">12日</div>
                        <div class="swiper-slide">13日</div>
                        <div class="swiper-slide">14日</div>
                        <div class="swiper-slide">15日</div>
                        <div class="swiper-slide">16日</div>
                        <div class="swiper-slide">17日</div>
                        <div class="swiper-slide">18日</div>
                        <div class="swiper-slide">19日</div>
                        <div class="swiper-slide">20日</div>
                        <div class="swiper-slide">21日</div>
                        <div class="swiper-slide">22日</div>
                        <div class="swiper-slide">23日</div>
                        <div class="swiper-slide">24日</div>
                        <div class="swiper-slide">25日</div>
                        <div class="swiper-slide">26日</div>
                        <div class="swiper-slide">27日</div>
                        <div class="swiper-slide">28日</div>
                        <div class="swiper-slide">29日</div>
                        <div class="swiper-slide">30日</div>
                        <div class="swiper-slide">31日</div>
                    </div>
                </div>
            </div>
        </div>
        <div class="tc-bot">
            <div class="tc-bot-left">回到今天</div>
            <div class="tc-bot-right">确定</div>
            <i></i>
        </div>
    </div>
</section>
<script type="text/javascript" src="/public/vendor/calendar/js/common.js"></script>

<script>
    //全局的年月日，适用于任何时候获取今天的年月日。（很重要）
    var sev_m, sev_y, sev_d, active = 3;
    var mySwiper = new Swiper('.swiper-container', {
        initialSlide: 1,
        loop: true,
        speed: 400,

        followFinger: false,
        prevButton: '.js_prev',
        nextButton: '.js_next',
        onSlideChangeStart: function(swiper) {
            //swiper.params.allowSwipeToPrev = false;
            swiper.lockSwipes();

        },

        onSlideChangeEnd: function(swiper) {

            var nows = $(".swiper-slide-active").find("table").attr("id");
            if (nows == 'now2')
                return;
            nows = parseInt(nows.substr(1, 1));
            //console.log(active,nows);
            if (nows == active)
                return;
            if (active == 4 && nows == 5) {
                var fors = 1;

                sev_m++;
                if (sev_m > 12) {
                    sev_m = 1;
                    sev_y++;
                }
                var nowweak = new Date(sev_y, sev_m - 1, 1).getDay();
                get_first(nowweak, sev_y, sev_m, 0, "d2");

                var lastm = sev_m - 1;
                var lasty = sev_y;
                if (lastm < 1) {
                    lastm = 12;
                    lasty--;
                }

                var nm = sev_m + 1;
                var ny = sev_y;
                if (nm > 12) {
                    nm = 1;
                    ny++;
                }
                var nowweak = new Date(ny, nm - 1, 1).getDay();
                var lastweek = new Date(lasty, lastm - 1, 1).getDay();
                get_first(lastweek, lasty, lastm, 0, "d" + fors);
                get_first(nowweak, ny, nm, 0, "d3");
                $("#ymym").html(sev_y + "年" + sev_m + "月");
                active = 5;
            } else if (active == 2 && nows == 1) {
                var fors = 5;

                var nextweak = new Date(sev_y, sev_m - 1, 1).getDay();
                get_first(nextweak, sev_y, sev_m, 0, "d" + fors);
                sev_m--;
                if (sev_m < 1) {
                    sev_m = 12;
                    sev_y--;
                }
                var nowweak = new Date(sev_y, sev_m - 1, 1).getDay();
                get_first(nowweak, sev_y, sev_m, 0, "d4");

                var nm = sev_m - 1;
                var ny = sev_y;
                if (nm < 1) {
                    nm = 12;
                    ny--;
                }
                var nowweak = new Date(ny, nm - 1, 1).getDay();
                //get_first(nowweak, ny, nm, 0, "d4");
                get_first(nowweak, ny, nm, 0, "d3");
                $("#ymym").html(sev_y + "年" + sev_m + "月");
                active = 1;
            } else if (active == 5 && nows == 3) {
                var fors = 4;

                var lastm = sev_m;
                var lasty = sev_y;

                sev_m++;
                if (sev_m > 12) {
                    sev_m = 1;
                    sev_y++;
                }

                var nm = sev_m + 1;
                var ny = sev_y;
                if (nm > 12) {
                    nm = 1;
                    ny++;
                }
                var nowweak = new Date(ny, nm - 1, 1).getDay();
                get_first(nowweak, ny, nm, 0, "d" + fors);
                var nowweak = new Date(lasty, lastm - 1, 1).getDay();
                get_first(nowweak, lasty, lastm, 0, "d2");
                $("#ymym").html(sev_y + "年" + sev_m + "月");
                active = 3;
            } else if (active == 1 && nows == 3) {
                var fors = 2;

                var lastm = sev_m;
                var lasty = sev_y;

                sev_m--;
                if (sev_m < 1) {
                    sev_m = 12;
                    sev_y--;
                }

                var nm = sev_m - 1;
                var ny = sev_y;
                if (nm < 1) {
                    nm = 12;
                    ny--;
                }
                var nowweak = new Date(ny, nm - 1, 1).getDay();
                get_first(nowweak, ny, nm, 0, "d" + fors);
                var nowweak = new Date(lasty, lastm - 1, 1).getDay();
                get_first(nowweak, lasty, lastm, 0, "d4");
                $("#ymym").html(sev_y + "年" + sev_m + "月");
                active = 3;
            } else if (active == 1 && nows == 5) {
                var fors = 3;

                var lastm = sev_m;
                var lasty = sev_y;

                sev_m++;
                if (sev_m > 12) {
                    sev_m = 1;
                    sev_y++;
                }

                var nm = sev_m + 1;
                var ny = sev_y;
                if (nm > 12) {
                    nm = 1;
                    ny++;
                }
                var nowweak = new Date(ny, nm - 1, 1).getDay();
                get_first(nowweak, ny, nm, 0, "d" + fors);
                $("#ymym").html(sev_y + "年" + sev_m + "月");
                active = 5;
            } else if (active == 5 && nows == 1) {
                var fors = 3;


                sev_m--;
                if (sev_m < 1) {
                    sev_m = 12;
                    sev_y--;
                }
                var lastm = sev_m;
                var lasty = sev_y;

                var nm = sev_m - 1;
                var ny = sev_y;
                if (nm < 1) {
                    nm = 12;
                    ny--;
                }
                var nowweak = new Date(ny, nm - 1, 1).getDay();
                var lastweak = new Date(lasty, sev_m - 1, 1).getDay();
                get_first(nowweak, ny, nm, 0, "d" + fors);
                console.log(lasty, lastm)
                get_first(lastweak, lasty, sev_m, 0, "d4");
                $("#ymym").html(sev_y + "年" + sev_m + "月");
                active = 1;
            } else if (active > nows) {
                var fors = nows - 1;
                if (fors < 1)
                    fors = 5;

                sev_m--;
                if (sev_m < 1) {
                    sev_m = 12;
                    sev_y--;
                }

                var nm = sev_m - 1;
                var ny = sev_y;
                if (nm < 1) {
                    nm = 12;
                    ny--;
                }
                var nowweak = new Date(ny, nm - 1, 1).getDay();
                get_first(nowweak, ny, nm, 0, "d" + fors);
                $("#ymym").html(sev_y + "年" + sev_m + "月");
                active = nows;
            } else if (active < nows) {
                var fors = nows + 1;
                if (fors > 5)
                    fors = 1;

                sev_m++;
                if (sev_m > 12) {
                    sev_m = 1;
                    sev_y++;
                }

                var nm = sev_m + 1;
                var ny = sev_y;
                if (nm > 12) {
                    nm = 1;
                    ny++;
                }
                var nowweak = new Date(ny, nm - 1, 1).getDay();
                get_first(nowweak, ny, nm, 0, "d" + fors);
                $("#ymym").html(sev_y + "年" + sev_m + "月");
                active = nows;
            }
            var trLength = $("#d" + nows).find("tr").length;
            if (trLength == 6) {
                $(".swiper-container").css("paddingBottom", ".45rem");
            } else {
                $(".swiper-container").css("paddingBottom", "");

            }
            swiper.unlockSwipes();
        }

    })
</script>
<script>
    var yl = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

    function onloads() {

        // window.onload = function() {
        $("#now3").attr("id", "d1");
        $("#now1").attr("id", "d2");
        $("#now2").attr("id", "d3");
        $("#now3").attr("id", "d4");
        $("#now1").attr("id", "d5");
        var globledate = new Date();
        var y = globledate.getFullYear();
        var m = globledate.getMonth() + 1;
        var d = globledate.getDate();
        sev_m = m;
        sev_y = y;
        sev_d = d;
        var nowweak = new Date(y, m - 1, 1).getDay();
        if (nowweak == 7) nowweak = 0;
        get_first(nowweak, y, m, d, "d3");
        set_top(0);

        m = m + 1;
        if (m > 12) {
            m = 1;
            y += 1;
        }
        nowweak = new Date(y, m - 1, 1).getDay();
        get_first(nowweak, y, m, 0, "d4");

        m = sev_m - 1;
        if (m < 1) {
            m = 12;
            y = sev_y - 1;
        }
        nowweak = new Date(y, m - 1, 1).getDay();
        get_first(nowweak, y, m, 0, "d2");

        $("#ymym").html(sev_y + "年" + sev_m + "月");

        $(".js_jin").click(function() {
            active = 3;
            var globledate = new Date();
            var y = globledate.getFullYear();
            var m = globledate.getMonth() + 1;
            var d = globledate.getDate();
            sev_m = m;
            sev_y = y;
            sev_d = d;
            var nowweak = new Date(y, m - 1, 1).getDay();
            if (nowweak == 7) nowweak = 0;
            get_first(nowweak, y, m, d, "d3");
            set_top(0);

            m = m + 1;
            if (m > 12) {
                m = 1;
                y += 1;
            }
            nowweak = new Date(y, m - 1, 1).getDay();
            get_first(nowweak, y, m, 0, "d4");

            m = sev_m - 1;
            if (m < 1) {
                m = 12;
                y = sev_y - 1;
            }
            nowweak = new Date(y, m - 1, 1).getDay();
            get_first(nowweak, y, m, 0, "d2");

            $("#ymym").html(sev_y + "年" + sev_m + "月");
            mySwiper.slideTo(2, 500, false);
        });
        mySwiper.unlockSwipes();
        // };
    }
    //$(window).ajaxStart(function(){
    //    $(".covers").show();
    //  })
    //  $(window).ajaxStop(function(){
    //    $(".covers").hide();
    //  });
    function jump(yyyy, mm, dd) {
        sev_y = parseInt(yyyy);
        sev_m = parseInt(mm);
        sev_d = parseInt(dd);

        active = 3;
        var globledate = new Date(yyyy, parseInt(mm) - 1, parseInt(dd));
        //var nowweak = globledate.getDay();
        var y = globledate.getFullYear();
        var m = globledate.getMonth() + 1;
        var d = globledate.getDate();
        //console.log("globledate:",y,m,d);

        var sev_m_tmp = m;
        var sev_y_tmp = y;
        var sev_d_tmp = d;
        var nowweak = new Date(y, m - 1, 1).getDay();
        if (nowweak == 7) nowweak = 0;
        get_first(nowweak, y, m, d, "d3");
        //set_top(0);

        m = m + 1;
        if (m > 12) {
            m = 1;
            y += 1;
        }
        nowweak = new Date(y, m - 1, 1).getDay();
        get_first(nowweak, y, m, 0, "d4");

        m = sev_m - 1;
        if (m < 1) {
            m = 12;
            y = sev_y - 1;
        }
        nowweak = new Date(y, m - 1, 1).getDay();
        get_first(nowweak, y, m, 0, "d2");

        $("#ymym").html(sev_y + "年" + sev_m + "月");
        $(".covers").hide();
        mySwiper.slideTo(2, 500, false);
        click_sev();

    }

    function click_sev() {
        $("#d3").find("td").each(function() {
            if ($(this).attr("data_y") == sev_y && $(this).attr("data_m") == sev_m && $(this).attr("data_d") == sev_d) {
                $(this).click();
            }
        });
    }

    function get_first(a, b, c, d, e) {
        var str = '<tr>';
        if ((c - 2) < 0) {
            var ldays = 31;
            var lm = 12;
            var lb = b - 1;
        } else {
            var ldays = yl[c - 2];
            var lm = c - 1;
            var lb = b;
        }

        if (c == 12) {
            var xdays = 31;
            var xm = 1;
            var xb = b + 1;
        } else {
            var xdays = yl[c];
            var xm = c + 1;
            var xb = b;
        }

        if (ldays == 28) {
            if ((lb % 4 == 0 && lb % 100 != 0) || (lb % 100 == 0 && lb % 400 == 0)) {
                ldays = 29;
            }
        }

        if (xdays == 28) {
            if ((xb % 4 == 0 && xb % 100 != 0) || (xb % 100 == 0 && xb % 400 == 0)) {
                xdays = 29;
            }
        }
        var dd;
        if (yl[c - 1] == 28) {
            if ((b % 4 == 0 && b % 100 != 0) || (b % 100 == 0 && b % 400 == 0)) {
                dd = 29;
            } else {
                dd = 28;
            }
        } else {
            dd = yl[c - 1];
        }

        var num = 1;

        for (var i = a; i > 0; i--) {
            var bday = ldays - i + 1;
            var ly = LunarDate.GetLunarDayDetail(lb, lm, bday);
            var jq = getjq(lb, lm, bday);
            if (jq) {
                ly = '<font color="#00b7ec">' + jq;
            }
            var jd = "";
            var hb = lb + "-" + lm + "-" + bday;

            // if (fj.indexOf(hb) >= 0) {
            //     jd = "<span class='fangjia'></span>";
            // }
            // if (sb.indexOf(hb) >= 0) {
            //     jd = "<span class='shangban'></span>";
            // }
            // if (gj.indexOf(hb) >= 0) {
            //     ly = '<font color="#00b7ec">' + gjs[gj.indexOf(hb)];
            // }
            str += ' <td data_y="' + lb + '" data_m="' + lm + '" data_d="' + bday + '" class="list not_this js_up"><i>' + bday + '</i><em>' + ly + '</em>' + jd + '</td>';
            if (num % 7 == 0) {
                str += '</tr><tr>';
            }
            num++;
        }

        for (var i = 1; i <= dd; i++) {
            var bday = ldays - i + 1;
            var ly = LunarDate.GetLunarDayDetail(b, c, i);
            var jq = getjq(b, c, i);
            if (jq) {
                ly = '<font color="#00b7ec">' + jq;
            }
            var jd = "";
            var hb = b + "-" + c + "-" + i;
            if (new Date().getDate() == i && b == new Date().getFullYear() && c == (new Date().getMonth() + 1)) {
                str += ' <td data_y="' + b + '" data_m="' + c + '" data_d="' + i + '" class="list today"><i>' + i + '</i><em>' + ly + '</em>' + jd + '</td>';
            } else {
                str += ' <td data_y="' + b + '" data_m="' + c + '" data_d="' + i + '" class="list"><i>' + i + '</i><em>' + ly + '</em>' + jd + '</td>';
            }

            if (num % 7 == 0) {
                str += '</tr><tr>';
            }
            num++;
        }

        var last = 42 - a - dd;
        if (last <= 6) {

            for (var i = 1; i <= last; i++) {
                var ly = LunarDate.GetLunarDayDetail(xb, xm, i);
                var jq = getjq(xb, xm, i);
                if (jq) {
                    ly = '<font color="#00b7ec">' + jq;
                }
                var jd = "";
                var hb = xb + "-" + xm + "-" + i;
                str += ' <td data_y="' + xb + '" data_m="' + xm + '" data_d="' + i + '" class="list not_this js_down"><i>' + i + '</i><em>' + ly + '</em>' + jd + '</td>';
                if (num % 7 == 0) {
                    str += '</tr><tr>';
                }
                num++;
            }
        }
        if (str.substring(str.length - 4, str.length) == "<tr>") {
            str = str.substring(0, str.length - 4);
        }
        document.getElementById(e).innerHTML = str;
        bind_click(e);
    }

    function bind_click(a) {
        $("#" + a).find("td").unbind("click");
        $("#" + a).find("td").each(function() {
            if ($(this).hasClass('not_this')) {
                $(this).click(function() {
                    jump($(this).attr('data_y'), $(this).attr('data_m'), $(this).attr('data_d'));
                });
            } else {
                $(this).click(function() {
                    set_top($(this));
                });
            }
        });
    }


    function set_top(a) {
        if (!a) {
            var weeks = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'];
            var data = new Date();
            var weekk = weeks[data.getDay() - 1];
            var yue = LunarDate.GetLunarDay(data.getFullYear(), data.getMonth(), data.getDate());
            var shu = data.getDate();
            document.getElementById("top_shu").innerHTML = shu;
            sev_d = parseInt(shu);
            document.getElementById("top_week").innerHTML = weekk;
            document.getElementById("top_yue").innerHTML = yue;
        } else {
            var weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
            var y = a.attr("data_y");
            var m = parseInt(a.attr("data_m")) - 1;
            if (m < 0) m = 11;
            var d = parseInt(a.attr("data_d"));
            var weekk = weeks[new Date(y, m, d).getDay()];
            var ms = parseInt(a.attr("data_m"));
            var yue = LunarDate.GetLunarDay(y, ms, d);
            document.getElementById("top_shu").innerHTML = d;
            sev_d = parseInt(d);
            document.getElementById("top_week").innerHTML = weekk;
            document.getElementById("top_yue").innerHTML = yue;
            $(".xuanzhong").removeClass('xuanzhong');
            a.addClass("xuanzhong");
        }
    }

    var LunarDate = {
        madd: new Array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334),
        HsString: '甲乙丙丁戊己庚辛壬癸',
        EbString: '子丑寅卯辰巳午未申酉戌亥',
        NumString: "一二三四五六七八九十",
        MonString: "正二三四五六七八九十冬腊",
        CalendarData: new Array(0xA4B, 0x5164B, 0x6A5, 0x6D4, 0x415B5, 0x2B6, 0x957, 0x2092F, 0x497, 0x60C96, 0xD4A, 0xEA5, 0x50DA9, 0x5AD, 0x2B6, 0x3126E, 0x92E, 0x7192D, 0xC95, 0xD4A, 0x61B4A, 0xB55, 0x56A, 0x4155B, 0x25D, 0x92D, 0x2192B, 0xA95, 0x71695, 0x6CA, 0xB55, 0x50AB5, 0x4DA, 0xA5B, 0x30A57, 0x52B, 0x8152A, 0xE95, 0x6AA, 0x615AA, 0xAB5, 0x4B6, 0x414AE, 0xA57, 0x526, 0x31D26, 0xD95, 0x70B55, 0x56A, 0x96D, 0x5095D, 0x4AD, 0xA4D, 0x41A4D, 0xD25, 0x81AA5, 0xB54, 0xB6A, 0x612DA, 0x95B, 0x49B, 0x41497, 0xA4B, 0xA164B, 0x6A5, 0x6D4, 0x615B4, 0xAB6, 0x957, 0x5092F, 0x497, 0x64B, 0x30D4A, 0xEA5, 0x80D65, 0x5AC, 0xAB6, 0x5126D, 0x92E, 0xC96, 0x41A95, 0xD4A, 0xDA5, 0x20B55, 0x56A, 0x7155B, 0x25D, 0x92D, 0x5192B, 0xA95, 0xB4A, 0x416AA, 0xAD5, 0x90AB5, 0x4BA, 0xA5B, 0x60A57, 0x52B, 0xA93, 0x40E95),
        Year: null,
        Month: null,
        Day: null,
        TheDate: null,
        GetBit: function(m, n) {
            return (m >> n) & 1;
        },
        e2c: function() {
            this.TheDate = (arguments.length != 3) ? new Date() : new Date(arguments[0], arguments[1], arguments[2]);
            var total, m, n, k;
            var isEnd = false;
            var tmp = this.TheDate.getFullYear();
            total = (tmp - 1921) * 365 + Math.floor((tmp - 1921) / 4) + this.madd[this.TheDate.getMonth()] + this.TheDate.getDate() - 38;
            if (this.TheDate.getYear() % 4 == 0 && this.TheDate.getMonth() > 1) {
                total++;
            }
            for (m = 0;; m++) {
                k = (this.CalendarData[m] < 0xfff) ? 11 : 12;
                for (n = k; n >= 0; n--) {
                    if (total <= 29 + this.GetBit(this.CalendarData[m], n)) {
                        isEnd = true;
                        break;
                    }
                    total = total - 29 - this.GetBit(this.CalendarData[m], n);
                }
                if (isEnd)
                    break;
            }
            this.Year = 1921 + m;
            this.Month = k - n + 1;
            this.Day = total;
            if (k == 12) {
                if (this.Month == Math.floor(this.CalendarData[m] / 0x10000) + 1) {
                    this.Month = 1 - this.Month;
                }
                if (this.Month > Math.floor(this.CalendarData[m] / 0x10000) + 1) {
                    this.Month--;
                }
            }
        },
        GetcDateString: function(tip) {
            if (tip == 1) {
                var ts = (this.Day < 11) ? "初" : ((this.Day < 20) ? "十" : ((this.Day < 30) ? "廿" : "三十"));
                if (this.Day % 10 != 0 || this.Day == 10) {
                    ts += this.NumString.charAt((this.Day - 1) % 10);
                }
                return ts;
            }
            var tmp = "";
            // tmp += this.HsString.charAt((this.Year - 4) % 10);
            // tmp += this.EbString.charAt((this.Year - 4) % 12);
            // tmp += "年 ";
            if (this.Month < 1) {
                //tmp += "(闰)";
                tmp += this.MonString.charAt(-this.Month - 1);
            } else {
                tmp += this.MonString.charAt(this.Month - 1);
            }
            tmp += "月";
            tmp += (this.Day < 11) ? "初" : ((this.Day < 20) ? "十" : ((this.Day < 30) ? "廿" : "三十"));
            if (this.Day % 10 != 0 || this.Day == 10) {
                tmp += this.NumString.charAt((this.Day - 1) % 10);
            }
            return tmp;
        },
        GetLunarDay: function(solarYear, solarMonth, solarDay) {
            if (solarYear < 1921 || solarYear > 2020) {
                return "";
            } else {
                solarMonth = (parseInt(solarMonth) > 0) ? (solarMonth - 1) : 11;
                this.e2c(solarYear, solarMonth, solarDay);
                return this.GetcDateString(0);
            }
        },
        GetLunarDayDetail: function(solarYear, solarMonth, solarDay) {
            if (solarYear < 1921 || solarYear > 2020) {
                return "";
            } else {
                solarMonth = (parseInt(solarMonth) > 0) ? (solarMonth - 1) : 11;
                this.e2c(solarYear, solarMonth, solarDay);
                return this.GetcDateString(1);
            }
        }
    };

    function getjq(yyyy, mm, dd) {
        if (yyyy == 2016 && mm == 12 && dd == 7) {
            return "大雪";
        }
        if (yyyy == 2016 && mm == 12 && dd == 6) {
            return "";
        }
        mm = mm - 1;
        var sTermInfo = new Array(0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758);
        var solarTerm = new Array("小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至");
        var tmp1 = new Date((31556925974.7 * (yyyy - 1900) + sTermInfo[mm * 2 + 1] * 60000) + Date.UTC(1900, 0, 6, 2, 5));
        var tmp2 = tmp1.getUTCDate();
        var solarTerms = "";
        if (tmp2 == dd)
            solarTerms = solarTerm[mm * 2 + 1];
        tmp1 = new Date((31556925974.7 * (yyyy - 1900) + sTermInfo[mm * 2] * 60000) + Date.UTC(1900, 0, 6, 2, 5));
        tmp2 = tmp1.getUTCDate();
        if (tmp2 == dd)
            solarTerms = solarTerm[mm * 2];
        return solarTerms;
    }

    $(function() {

        $(".prorup").on("click", function() {
            $(".prorup").hide();
            $(".jie").hide();
            $(".layer").hide();
        });

        $(".jqclass").click(function() {
            var riziss = $(this).attr('data');
            var srt = riziss.split("-");
            $(".prorup").hide();
            $(".layer").hide();
            jump(srt[0], srt[1], srt[2]);
            $(".jie").hide();
        });

    });

    $('.date').on('click', function() {

        $('.tc').show();
        $('.tc-innner').show();

        tc();

    });

    var e = 1;

    function tc() {
        var b, c, d;
        var myDate = new Date();

        if (e == 0) {
            b = myDate.getFullYear() - 1900;
            c = myDate.getMonth();
            d = myDate.getDate() - 1;

        } else {
            b = sev_y - 1900;
            c = sev_m - 1;
            d = sev_d - 1;


        }
        e = 1;
        var mySwiper = new Swiper('.swiper-container2', {
            direction: 'vertical',
            initialSlide: b,
            slidesPerView: 'auto',
            roundLengths: true,
            centeredSlides: true,

            watchSlidesProgress: true,
            watchSlidesVisibility: true,

            freeMode: true,
            freeModeMomentumRatio: 1,
            freeModeSticky: true,
            onTouchMove: function(swiper) {
                var b1 = $('.year').children('.swiper-slide-active').html();
                $('.i-year').html(b1);
            },
            onSlideChangeEnd: function(swiper) {
                var b1 = $('.year').children('.swiper-slide-active').html();
                $('.i-year').html(b1);
            },


        });
        var mySwiper = new Swiper('.swiper-container3', {
            direction: 'vertical',
            initialSlide: c,
            slidesPerView: 'auto',
            roundLengths: true,
            centeredSlides: true,

            watchSlidesProgress: true,
            watchSlidesVisibility: true,

            freeMode: true,
            freeModeMomentumRatio: 1,
            freeModeSticky: true,
            onTouchMove: function(swiper) {
                var b1 = $('.month').children('.swiper-slide-active').html();
                $('.i-month').html(b1);
            },
            onSlideChangeEnd: function(swiper) {
                var b1 = $('.month').children('.swiper-slide-active').html();
                $('.i-month').html(b1);
            },


        });
        var mySwiper = new Swiper('.swiper-container4', {
            direction: 'vertical',
            initialSlide: d,
            slidesPerView: 'auto',
            roundLengths: true,
            centeredSlides: true,

            watchSlidesProgress: true,
            watchSlidesVisibility: true,

            freeMode: true,
            freeModeMomentumRatio: 1,
            freeModeSticky: true,
            onTouchMove: function(swiper) {
                var b1 = $('.date').children('.swiper-slide-active').html();
                $('.i-date').html(b1);
            },
            onSlideChangeEnd: function(swiper) {
                var b1 = $('.date').children('.swiper-slide-active').html();
                $('.i-date').html(b1);
            },

        });
    };

    $('.tc-bot-left').click(function() {
        e = 0;
        tc();
    });
    $('.tc-bot-right').click(function() {
        $('.tc').hide();
        $('.tc-innner').hide();
        var yyyy = parseInt($('.year').children('.swiper-slide-active').html());
        var mm = parseInt($('.month').children('.swiper-slide-active').html());
        var dd = parseInt($('.date').children('.swiper-slide-active').html());
        if (mm != sev_m || yyyy != sev_y || dd != sev_d) {
            jump(yyyy, mm, dd);

        };



    });
    $(".tc").on("click", function() {
        $(".tc-innner").hide();
        $(this).hide();
    });
</script>
            <!--  -->
            <div class="relogio">
                <div>
                    <center>
                        <span id="todaydatetime" class=""></span>
                    </center>
                </div>
            </div>

        </div>
        <div class="list hidden zindex">
            <div class="empty" style="position: absolute;width: 100%;">
                没有通讯好友
            </div>
            <ul>
                <?php if(is_array($rooms_list) || $rooms_list instanceof \think\Collection || $rooms_list instanceof \think\Paginator): $i = 0; $__LIST__ = $rooms_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                <!--  -->
                <?php if($vo['type'] == '1'): ?>
                <li class="room<?php echo $vo['id']; ?> roomgroup">
                    <a href="###" onclick="cutoverActive(this)" data-id="<?php echo $vo['id']; ?>" data-group='1'>
                        <div class="ide"></div>
                        <div class="head"><?php echo $vo['ide']; ?></div>
                        <div class="name">
                            <div class="nick"><?php echo $vo['group_name']; ?></div>
                            <div class="msg"><?php echo userTextDecode($vo['details']['content']); ?></div>
                        </div>
                    </a>
                    <div class="time"><?php echo totime($vo['details']['created_time'],'H:i'); ?></div>
                </li>
                <?php else: ?>
                <!--  -->
                <?php if($vo['user_id'] == $user_id): ?>
                <li class="room<?php echo $vo['id']; ?>">
                    <a href="###" onclick="cutoverActive(this)" data-other_id="<?php echo $vo['other_id']; ?>" data-id="<?php echo $vo['id']; ?>" data-user_id="<?php echo $vo['user_id']; ?>" data-type="is_u_show">
                        <div class="ide <?php if($vo['u_unread'] == '1'): ?>show<?php endif; ?>"></div>
                        <div class="head"><?php echo $vo['other']['ide']; ?></div>
                        <div class="name">
                            <div class="nick"><?php echo $vo['other']['nickname']; ?></div>
                            <div class="msg"><?php echo userTextDecode($vo['details']['content']); ?></div>
                        </div>
                    </a>
                    <div class="time"><?php echo totime($vo['details']['created_time'],'H:i'); ?></div>
                </li>
                <?php else: ?>
                <li class="room<?php echo $vo['id']; ?>">
                    <a href="###" onclick="cutoverActive(this)" data-other_id="<?php echo $vo['user_id']; ?>" data-id="<?php echo $vo['id']; ?>" data-user_id="<?php echo $vo['other_id']; ?>" data-type="is_o_show">
                        <div class="ide <?php if($vo['u_unread'] == '1'): ?>show<?php endif; ?>"></div>
                        <div class="head"><?php echo $vo['user']['ide']; ?></div>
                        <div class="name">
                            <div class="nick"><?php echo $vo['user']['nickname']; ?></div>
                            <div class="msg"><?php echo userTextDecode($vo['details']['content']); ?></div>
                        </div>
                        <div class="time"><?php echo totime($vo['details']['created_time'],'H:i'); ?></div>
                    </a>
                </li>
                <?php endif; ?>
                <!--  -->
                <?php endif; ?>
                <!--  -->
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </ul>
        </div>
        <div class="list2 hidden">
            <div class="group msg2">
                <div class="category">新朋友</div>
                <ul>
                    <li onclick="openMessage(this)">
                        <a href="###">
                            <div class="ide"></div>
                            <div class="head">新</div>
                            <div class="name">新朋友</div>
                        </a>
                    </li>
                </ul>
            </div>
            <div class="group">
                <div class="category" onclick="cutoverGroup(this)" data-id="qgroup">群组<span class="caret"></span></div>
                <ul class="hidden" id="qgroup">
                    <?php if(is_array($group) || $group instanceof \think\Collection || $group instanceof \think\Paginator): $i = 0; $__LIST__ = $group;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                    <li onclick="openGroup(this)" data-name="<?php echo $vo['group_name']; ?>" data-id="<?php echo $vo['id']; ?>">
                        <a href="###">
                            <div class="head"><?php echo $vo['ide']; ?></div>
                            <div class="name">
                                <?php echo $vo['group_name']; ?>
                            </div>
                        </a>
                    </li>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                </ul>
            </div>
            <div class="group">
                <div class="category" onclick="cutoverGroup(this)" data-id="lgroup" style="margin-bottom:10px;">联系人<span class="caret"></span></div>
                <div class="hidden" id="lgroup">
                    <?php if(is_array($arr) || $arr instanceof \think\Collection || $arr instanceof \think\Paginator): $i = 0; $__LIST__ = $arr;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                    <!--  -->
                    <?php if(!(empty($vo) || (($vo instanceof \think\Collection || $vo instanceof \think\Paginator ) && $vo->isEmpty()))): ?>
                    <div class="category"><?php echo $key; ?></div>
                    <ul>
                        <?php if(is_array($vo) || $vo instanceof \think\Collection || $vo instanceof \think\Paginator): $i = 0; $__LIST__ = $vo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                        <li onclick="openfriend(this)" data-name="<?php echo $v['nickname']; ?>" data-id="<?php echo $v['id']; ?>">
                            <a href="###">
                                <div class="head"><?php echo $v['ide']; ?></div>
                                <div class="name">
                                    <?php echo $v['nickname']; ?>
                                </div>
                            </a>
                        </li>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </ul>
                    <?php endif; ?>
                    <!--  -->
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="/public/chat/js/times.js"></script>

<script>
    function displayTime() {
        var elt = document.getElementById("todaydatetime");
        var now = new Date();
        var h = now.getHours();
        var m = now.getMinutes();
        var s = now.getSeconds();
        var ms = now.getMilliseconds();
        if (h < 10) {
            h = '0' + h;
        }
        if (m < 10) {
            m = '0' + m;
        }
        if (s < 10) {
            s = '0' + s;
        }
        elt.innerHTML = h + ":" + m + ":" + s;
        setTimeout(displayTime, 100);
    }
    displayTime();

    //打开好友界面
    function openfriend(e) {
        $('.home .center .list2 li').removeClass('active');
        $(e).addClass('active');
        var title = $(e).data('name');
        var id = $(e).data('id');
        var url = "<?php echo url('friend_info'); ?>?id=" + id;
        layer.closeAll();
        width = $(window).width();
        layer.open({
            btn: ['发消息', '关闭'],
            type: 2,
            title: title,
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['300px', '250px'],
            content: url,
            btnclass: ['btn btn-info', 'btn btn-danger'],
            yes: function(index, layero) {
                layer.closeAll()
                $.get("<?php echo url('create_friend'); ?>?id=" + id, function(res) {
                    $('.home .left .contacts').removeClass('active');
                    $('.home .left .message').addClass('active');
                    $('.home .center .box .list2').addClass('hidden');
                    $('.home .center .box .list').removeClass('hidden');
                    var user_id = "<?php echo getSessInfo('id'); ?>";
                    res = res.data;
                    if (res.user_id == user_id) {
                        updataMsg(res.id, '', res.other_id, res.time, res.user.nickname, user_id, res.user.ide, 'is_u_show');
                    } else {
                        updataMsg(res.id, '', user_id, res.time, res.user.nickname, res.other_id, res.user.ide, 'is_o_show');
                    }
                    cutoverActive($('.home .center .list .room' + res.id + ' a'));
                })
            },
            cancel: function() {
                return true;
            }
        });
        if (width > 700) {} else {
            $('.layui-layer').css('top', 0);
        }
    }


    //打开群组界面
    function openGroup(e) {
        $('.home .center .list2 li').removeClass('active');
        $(e).addClass('active');
        var title = $(e).data('name');
        var id = $(e).data('id');
        var url = "<?php echo url('group_info'); ?>?id=" + id;
        layer.closeAll();
        width = $(window).width();
        layer.open({
            btn: ['发消息', '关闭'],
            type: 2,
            title: title,
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['300px', '250px'],
            content: url,
            btnclass: ['btn btn-info', 'btn btn-danger'],
            yes: function(index, layero) {
                layer.closeAll()
                $('.home .left .contacts').removeClass('active');
                $('.home .left .message').addClass('active');
                $('.home .center .box .list2').addClass('hidden');
                $('.home .center .box .list').removeClass('hidden');
                cutoverActive($('.home .center .list .room' + id + ' a'));
            },
            cancel: function() {
                return true;
            }
        });
        if (width > 700) {} else {
            $('.layui-layer').css('top', 0);
        }
    }
    // function updataMsg(id, content, otherid, time, nickname, userid, ide) {

    /**
     *切换 消息界面 
     */
    function openMessage(e) {
        var status = 0;
        if ($(e).find('.active').length > 0) {
            $('.home .contacts .ide').hide().removeClass('active');
            $('.list2 .msg2 .ide').hide().removeClass('active');
            var status = 1;
        }
        $.get("<?php echo url('ide_friend'); ?>?status=" + status, function(res) {
            $('.box2 .message .contents ul').empty()
            if (res.code == 1) {
                $.each(res.data, function(i, v) {
                    console.log(v);
                    var html = '';
                    html += '<li class="list-group-item" id="li_' + v.id + '">';
                    html += '    <span class="head">' + v.user.ide + '</span>';
                    html += '    <span class="badge ' + v.class + ' btn" onclick="other_adds(this)" data-id="' + v.id + '">' + v.button + '</span>';
                    html += '    <div>' + v.user.nickname + '</div>';
                    html += '    <div style="font-size:14px;color:#999;">' + v.remark + '</div>';
                    html += ' </li>';
                    $('.box2 .message .contents ul').append(html)
                })
            }
        });
        $('.home .center .list2 li').removeClass('active');
        $(e).addClass('active');
        $('.box2 .message,.box2').removeClass('hidden');
    }
</script>
                        </div>
                    </div>
                    <!-- <iframe src="http://www.hrblkk.com" frameborder="0" width="700px" height="500px"></iframe> -->
                    <!-- <b style="color: ##795548;font-style: oblique;font-size: 39px;text-shadow: 5px 5px 5px #000;">能优化的地方太多了</b> -->

                    <!--  -->
                    <div class="col-md-9 col-sm-7 col-12 right">


    <div class="box hidden">
        <div class="nickname"></div>
        <div class="del">
            <img src="/public/chat/img/bg.png" alt="" onclick="dellist(this)">
        </div>
        <div class="contents">
            <div class="boxs" id="chat_data">
                <!-- <div class="message"><span>阿斯頓阿薩阿薩</span></div> -->
            </div>
        </div>
        <div class="textarea">
            <div class="tools">
                <ul>
                    <li>
                        <a href="javascript:;" onclick="swTools('emojiBox')"><img src="/public/chat/img/xl.png" alt=""></a>
                    </li>
                </ul>
                <div class="emoji hidden" id="emojiBox">
    <div class="group" id="emojiLi">
        <ul></ul>
    </div>
    <div class="category">
        <ul> </ul>
    </div>

</div>

<script src="/public/chat/js/emoji.js"></script>

<script>
    $.each(emojiKey, function(i, v) {
        if (i == 0) {
            $('#emojiBox .category ul').append('<li><a href="javascript:;" class="active" onclick="swEmoji(this)" data-id="' + v[1] + '">' + v[0] + '</a></li>');
        } else {
            $('#emojiBox .category ul').append('<li><a href="javascript:;" onclick="swEmoji(this)" data-id="' + v[1] + '">' + v[0] + '</a></li>');
        }
    })


    setEmoji(emojiKey[0][1]);

    function setEmoji(emoji) {
        $('#emojiLi ul').empty();
        var emojiarray = emojiArray[emoji].split(',');
        $.each(emojiarray, function(i, v) {
            $('#emojiLi ul').append('<li><a href="javascript:;" onclick="clEmoji(this)" data-emoji="' + v + '">' + v + '</a></li>');
        })
    }

    function clEmoji(e) {
        var emoji = $(e).data('emoji');
        var text = $('#textarea_data').val();
        text = text + emoji;
        $('#textarea_data').val(text);
    }

    function swEmoji(e) {
        $('#emojiBox .category ul li a').removeClass('active');
        $(e).addClass('active');
        setEmoji($(e).data('id'));

    }
</script>
            </div>
            <form action="" id="formdata">
                <textarea name="" id="textarea_data"></textarea>
                <span>按回车发送消息，ctrl+回车 换行</span>
                <input type="button" id="submit" value="发送(S)" onclick="onSubmit()">
            </form>
        </div>
    </div>
    <div class="box2 hidden">
        <div class="message hidden">
            <div class="title">新朋友</div>
            <div class="contents">
                <ul class="list-group mt-3">
                    <li class="list-group-item hidden" id="li_">
                        <span class="head">A</span>
                        <span class="badge btn-info btn" onclick="adds(this)" data-id='0' data-step="0">添加</span>
                        <div>nickname</div>
                        <div>13000000000</div>
                        <textarea name="" id="" class="form-control hidden" placeholder="请输入添加理由"></textarea>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
<script>
    function swTools(name) {
        $('#' + name).toggleClass('hidden');
    }

    // 提交对话
    function onSubmit() {
        var active = $('.home .center .list li.active a');
        var room_id = $(active).data('id');
        var user_id = "<?php echo getSessInfo('id'); ?>";

        var ide = "<?php echo getSessInfo('ide'); ?>";
        var input = $('#textarea_data').val();
        if ($(active).data('group') == 1) {
            var group_name = $(active).find('.nick').text();
            var groupide = $(active).find('.head').text();
            var data = {
                type: 'say',
                to_client_id: 'all',
                ide,
                room_id,
                user_id,
                group_name,
                groupide,
                content: input.replace('\r\n', '<br/>'),
            }
            console.log(data);

            ws.send(JSON.stringify(data))
        } else {
            //私聊
            var other_id = $(active).data('other_id');

            if (!input || input.replace(/\s/g, "") == '' || input.replace('\r\n', "") == '') {
                layer.msg('不可提交空数据');
                return false;
            }
            var data = {
                type: 'say_client',
                room_id,
                user_id,
                other_id,
                ide,
                content: input.replace('\r\n', '<br/>')
            }
            ws.send(JSON.stringify(data))
        }

        document.title = '首页';
        $('#textarea_data').val("").focus();
    }


    //回车
    $(document).keypress(function(e) {
        if (e.keyCode == 10 && e.ctrlKey) {
            var text = $('#textarea_data').val();
            text = text + '\n';
            $('#textarea_data').val(text);
        } else if (e.keyCode == 13) {
            onSubmit();
            return false;
        }
    })

    function other_adds(e) {
        var id = $(e).data('id');
        $.get("<?php echo url('confirm_friend'); ?>?id=" + id, function(res) {
            layer.msg(res.msg)
            if (res.code == 1) {
                var data = {
                    type: 'get_friend',
                    other_id: res.data
                };
                console.log(JSON.stringify(data));
                ws.send(JSON.stringify(data));
            }
        })
    }
</script>
                </div>
            </div>
        </div>

        <div id="chart_demo" class="hidden">
            <div class="medias flr">
                <div class="medias-left">
                    <div class="medias-head"></div>
                </div>
                <div class="medias-body">
                    <h4 class="medias-heading"></h4>
                    <div class="medias-text">
                        <div class="triangle"></div>
                        <div class="medias-content"></div>
                    </div>
                </div>
            </div>
        </div>



        <script>
            // 如果浏览器不支持websocket，会使用这个flash自动模拟websocket协议，此过程对开发者透明
            WEB_SOCKET_SWF_LOCATION = "/public/chat/swf/WebSocketMain.swf";
            // 开启flash的websocket debug
            WEB_SOCKET_DEBUG = true;

            var ws, name, client_list = {};

            // 连接服务端
            function connect() {
                //激活日历程序
                onloads();

                // 创建websocket
                ws = new WebSocket("ws://" + document.domain + ":7272");
                // 当socket连接打开时，输入用户名
                ws.onopen = onopen;
                // 当有消息时根据消息类型显示不同信息
                ws.onmessage = onmessage;
                ws.onclose = function() {
                    console.log("连接关闭，定时重连");
                    connect();
                };
                ws.onerror = function() {
                    console.log("出现错误");
                };
            }
            // 连接建立时发送登录信息
            function onopen() {
                var name = "<?php echo getSessInfo('nickname'); ?>";
                var user_id = "<?php echo getSessInfo('id'); ?>";

                // 登录
                var login_data = {
                    type: "login_client",
                    client_name: name.replace(/"/g, '\\"'),
                    user_id: user_id
                };
                console.log("websocket握手成功，发送登录数据:" + JSON.stringify(login_data));
                ws.send(JSON.stringify(login_data));

                /**测试链接发送消息*/
                var data = {
                    type: 'say_client',
                    room_id: 0,
                    user_id: 0,
                    other_id: 0,
                    ide: 0,
                    content: '链接测试'
                }
                ws.send(JSON.stringify(data))

            }


            // 服务端发来消息时
            function onmessage(e) {
                // console.log(e.data);
                var data = eval("(" + e.data + ")");
                switch (data['type']) {
                    // 服务端ping客户端
                    case 'ping':
                        //心跳提示
                        var data = {
                            type: 'pong'
                        }
                        ws.send(JSON.stringify(data));
                        break;
                        // 登录 更新用户列表
                    case 'all':
                        checkGroup(data);
                        break;
                    case 'login_client':
                        console.log(data['client_name'] + "登录成功");
                        break;
                        // 发言
                    case 'say_client':
                        // console.log('say', data);
                        if (!data.room_id && !data.user_id) {
                            return;
                        }
                        var active = $('.home .center .list li.active a');
                        if ($(active).data('id') == data['room_id']) {
                            //只在激活也显示
                            say(data['from_client_id'], data['from_client_name'], data['content'], data['time'], 2, data['ide']);
                            //更新未读消息提示
                            updataStatus(data['room_id']);
                        } else {
                            //如果不是激活页 
                            ideun(data['room_id']);
                        }
                        //更新列表描述
                        if (data['is_show'] == "<?php echo getSessInfo('id'); ?>") {
                            updataMsg(data['room_id'], data['content'], data['other_id'], data['time'], data['from_client_name'], "<?php echo getSessInfo('id'); ?>", data['ide'], 'is_u_show');
                        } else {
                            updataMsg(data['room_id'], data['content'], "<?php echo getSessInfo('id'); ?>", data['time'], data['from_client_name'], data['other_id'], data['ide'], 'is_o_show');
                        }
                        //更新网站title
                        document.title = '有新消息...';
                        //弹窗提示
                        alertShow(data['from_client_name'], data['content']);
                        break;
                        // 自己发言
                    case 'say_client_mi':
                        say(data['from_client_id'], data['from_client_name'], data['content'], data['time'], 1, data['ide']);
                        //更新列表描述
                        if (data['is_show'] == "<?php echo getSessInfo('id'); ?>") {
                            updataMsg(data['room_id'], data['content'], data['other_id'], data['time'], data['from_client_name'], "<?php echo getSessInfo('id'); ?>", data['ide'], 'is_u_show');
                        } else {
                            updataMsg(data['room_id'], data['content'], "<?php echo getSessInfo('id'); ?>", data['time'], data['from_client_name'], data['other_id'], data['ide'], 'is_o_show');
                        }
                        break;
                    case 'times':
                        var active = $('.home .center .list li.active a');
                        if ($(active).data('id') == data['room_id']) {
                            $('#chat_data').append('<div class="message"><span>' + data['content'] + '</span></div>');
                        }
                        break;
                        //群聊
                    case 'say':
                        var active = $('.home .center .list li.active a');
                        if ($(active).data('id') == data['room_id']) {
                            var user_id = "<?php echo getSessInfo('id'); ?>";
                            if (data['user_id'] == user_id) {
                                say(data['from_client_id'], data['from_client_name'], data['content'], data['time'], 1, data['ide']);
                            } else {
                                say(data['from_client_id'], data['from_client_name'], data['content'], data['time'], 2, data['ide']);
                            }
                        }
                        var dates = new Date();
                        $('.room' + data.room_id + " .msg").text(data.content);
                        $('.room' + data.room_id + " .time").text(dates.getHours() + ":" + dates.getMinutes());
                        break;
                    case 'add_friend':
                        $('.home .contacts .ide').show().addClass('active');
                        $('.list2 .msg2 .ide').show().addClass('active');
                        break;
                    case 'get_friend':
                        getFriend();
                        break;
                    case 'add_group':
                        $('.home .left .message').addClass('active');
                        $('.home .left .contacts').removeClass('active');
                        $('.home .left .user').removeClass('active');
                        $('.home .center .list2').addClass('hidden');
                        $('.home .center .list').removeClass('hidden');
                        $('.home .center .list0').addClass('hidden');
                        $('.home .right .box2').addClass('hidden');
                        $('.home .right .box').addClass('hidden');
                        getGroup();
                        checkGroup(data);
                        cutoverActive($('.home .center .list .room' + data['room_id'] + ' a'));
                        break;
                        // 用户退出 更新用户列表
                    case 'logout':
                        // say(data['from_client_id'], data['from_client_name'], data['from_client_name'] + ' 退出了', data['time'], data['ide']);
                        delete client_list[data['from_client_id']];
                }
            }

            // 发言 客户端地址 发送者名称 发送内容 时间 类型 标签 是否后追加
            function say(from_client_id, from_client_name, content, time, type, head = 'A', app = 'append') {
                if (type == 1) { //自己发言
                    $('#chart_demo .medias').removeClass('fll').addClass('flr');
                } else {
                    $('#chart_demo .medias').removeClass('flr').addClass('fll');
                }
                $('#chart_demo .medias-head').text(head);
                $('#chart_demo .medias-heading').text(from_client_name);
                // content = content.replace(/\n/g, "<br>");
                $('#chart_demo .medias-content').html(content);
                var html = $('#chart_demo').html();
                if (app == 'append') {
                    $('#chat_data').append(html);
                } else {
                    $('#chat_data').prepend(html);
                }
                ChangeScrollHeight(9999999);
            }

            /**
             * 标记未读
             */
            function ideun(id) {
                $('.room' + id).find('.ide').addClass('show');
                if ($('.home .left .message.active').length <= 0) {
                    $('.home .left .message').find('.ide').show();
                }
            }

            /**
             * 切换会话激活状态并加载历史记录
             */
            function cutoverActive(e) {
                // console.log(e);

                if ($(e).data('group') == 1) {
                    var name = "<?php echo getSessInfo('nickname'); ?>";
                    var user_id = "<?php echo getSessInfo('id'); ?>";
                    var room_id = $(e).data('id');
                    var data = {
                            type: 'login',
                            client_name: name,
                            user_id: user_id,
                            room_id: room_id
                        }
                        // console.log(data);

                    ws.send(JSON.stringify(data))
                }
                $('.list li').removeClass('active');
                $('.home .right .nickname').text($(e).find('.nick').text());
                $('.home .right .box').removeClass('hidden');
                var id = $(e).data('id');
                var user = "<?php echo $user_id; ?>";
                $('.room' + id).addClass('active');
                $('.room' + id).find('.ide').removeClass('show');

                document.title = '首页';
                if ($('.home .center .list li a .ide.show').length <= 0) {
                    $('.home .left .message').find('.ide').hide();
                }

                $.post("<?php echo url('getRoomsDetails'); ?>", {
                    id
                }, function(res) {
                    if (res.code == 1 || res.data.length > 0) {
                        $('#chat_data').empty();
                        $.each(res.data, function(i, v) {
                            var type = (user == v.user_id) ? 1 : 2;

                            if (v.type == 1) {
                                $('#chat_data').prepend('<div class="message"><span>' + v.content + '</span></div>');
                            } else {
                                say('', v.user.nickname, v.content, v.created_time, type, v.user.ide, 'prepend');
                            }
                        })
                    }
                })
                ChangeScrollHeight(9999999);

            }

            /**
             * 更新未读消息状态
             */
            function updataStatus(id) {
                $.get("<?php echo url('updateRoomsStatus'); ?>?id=" + id, function(res) {})
            }

            /*
             *删除列表
             */
            function dellist(e) {
                var active = $('.home .center .list li.active a');
                var id = $(active).data('id');
                var user = $(active).data('user_id');
                var type = $(active).data('type');
                var group = $(active).data('group');

                layer.confirm('确认要移除聊天吗？', {
                    btn: ['确认', '取消'] //按钮
                }, function() {
                    $.post("<?php echo url('dellist'); ?>", {
                        id,
                        user,
                        type,
                        group
                    }, function(res) {
                        layer.msg(res.msg);
                        if (res.code == 1) {
                            $('.room' + id).remove();
                            $('.home .right .box').addClass('hidden');
                        }
                    })
                }, function() {

                });
                return false;
            }

            /**
             * 更新列表描述
             */
            function updataMsg(id, content, otherid, time, nickname, userid, ide, is_o = 'is_o_show') {
                if ($('.room' + id).length > 0) {
                    $('.room' + id + " .msg").text(content);
                    $('.room' + id + " .time").text(time);
                } else {
                    var html = '';
                    html += ' <li class="room' + id + '">';
                    html += '   <a href="###" onclick="cutoverActive(this)" data-other_id="' + otherid + '" data-id="' + id + '" data-user_id="' + userid + '" data-type="' + is_o + '">';
                    html += '        <div class="ide show"></div>';
                    html += '        <div class="head">' + ide + '</div>';
                    html += '        <div class="name">';
                    html += '            <div class="nick">' + nickname + '</div>';
                    html += '            <div class="msg">' + content + '</div>';
                    html += '        </div>';
                    html += '        <div class="time">' + time + '</div>';
                    html += '    </a>';
                    html += '</li>';
                    $('.home .center .box .list ul').prepend(html);
                }


            }

            /**
             * 检测群组是否存在或激活
             */
            function checkGroup(data) {
                console.log(data);

                if ($('.roomgroup.room' + data['room_id']).length > 0) {
                    if ($('.roomgroup.active a').data('id') != data['room_id']) {
                        $('.roomgroup.room' + data['room_id']).find('.ide').addClass('show');
                        if ($('.home .left .message.active').length <= 0) {
                            $('.home .left .message').find('.ide').show();
                        }
                    }
                } else {
                    var user_id = "<?php echo getSessInfo('id'); ?>";
                    if (data.allids.indexOf("," + user_id + ",") >= 0) {
                        var html = "";
                        html += '';
                        html += '<li class="room' + data.room_id + ' roomgroup">';
                        html += '   <a href="###" onclick="cutoverActive(this)" data-id="' + data.room_id + '" data-group="1">';
                        html += '       <div class="ide show"></div>';
                        html += '           <div class="head">' + data.ide + '</div>';
                        html += '               <div class="name">';
                        html += '                    <div class="nick">' + data.group_name + '</div>';
                        html += '               <div class="msg">' + data.content + '</div>';
                        html += '           </div>';
                        html += '       </a>';
                        html += '   <div class="time">' + data.time + '</div>';
                        html += '</li>';
                        $('.home .center .box .list ul').prepend(html);
                    }
                }

            }
        </script>



        <script>
            var friend;

            function addfriend(type) {
                if (type == 'group') {
                    var url = "<?php echo url('addgroup'); ?>";
                    var title = "创建群聊";
                } else {
                    var url = "<?php echo url('addfriend'); ?>";
                    var title = "添加好友";
                }

                layer.closeAll();
                width = $(window).width();
                if (width > 700) {
                    friend = layer.open({
                        type: 2,
                        title: title,
                        shadeClose: true,
                        shade: false,
                        maxmin: true, //开启最大化最小化按钮
                        area: ['893px', '600px'],
                        content: url,
                    });
                } else {
                    friend = layer.open({
                        type: 2,
                        title: title,
                        shadeClose: true,
                        shade: false,
                        maxmin: true, //开启最大化最小化按钮
                        area: ['100%', '100%'],
                        content: url,
                    });
                    $('.layui-layer').css('top', 0);
                }
                cutoverAdd();
            }

            var newfriend = "<?php echo $newfriend; ?>";
            var newchat = "<?php echo $newchat; ?>"
            if (newfriend > 0) {
                $('.home .contacts .ide').show().addClass('active');
                $('.list2 .msg2 .ide').show().addClass('active');
            }
            if (newchat > 0) {
                $('.home .left .message .ide').show();
            }

            //获取好友列表
            function getFriend() {
                $.get("<?php echo url('getFriend'); ?>", function(res) {
                    if (res) {
                        $('#lgroup').empty().html(res);
                        openMessage();
                    }
                })
            }

            //获取好友列表
            function getGroup() {
                console.log(1);

                $.get("<?php echo url('getGroup'); ?>", function(res) {
                    if (res) {
                        $('#qgroup').empty().html(res);
                    }
                })
            }
        </script>

    </body>

</html>